﻿@{
    ViewData["Title"] = "Student";
}

<div class="row">
    <h2>
        欢迎用户：@ViewData["Userno"]
    </h2>
    <button class="btn" onclick="window.location.href='/Home/Login'">退出</button>
</div>
<div class="container">
    <h2>心理测试</h2>
    <table class="table table-hover">
        <thead>
            <tr>
                <th>id</th>
                <th>试卷名称</th>
                <th>试卷简述</th>
                <th>测试</th>
            </tr>
        </thead>
        <tbody>
            @foreach (var Row in ViewBag.Papers.Tables[0].Rows)
            {
                int i = 0;
                <tr>
                    @foreach (var Columnin in ViewBag.Papers.Tables[0].Columns)
                    {
                        i++;
                        if (i < 4)
                        {
                            <th>@Row[Columnin]</th>
                        }
                    }
                    <th>
                        <button id="@Row[0]" type="button" class="btn btn-primary" onclick="window.location.href='/Student/Paper?paperid=@Row[0]'">进入测试</button>
                    </th>
                </tr>
            }
        </tbody>
    </table>
</div>
<script>
$(document).ready(function () {
    var id = "@ViewData["Userno"]"
    if (id == "") {
        window.location.href = '/';
    };
    @foreach (var Row in ViewBag.Grade.Tables[0].Rows)
    {
        <text>
        $('#@Row[2]').attr("disabled", "disabled")
        $('#@Row[2]').text("已经测试,分数 @Row[3] 分");
        </text>
    }
})
</script>
